using System;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;

public abstract class EditorTestUI : PanelCommon,IBattleControllerView
{
    public Text testResultText;
    [SerializeField]
    protected BattleWidgetInfoController m_BattleWidgetInfoController;

    //protected BattleSceneEditorTest m_Ctrl;
    public override void Awake()
    {
        base.Awake();
    }

    public override void Start()
    {
        base.Start();

        if(testResultText)
            testResultText.text = "";

        if (m_BattleWidgetInfoController == null)
            m_BattleWidgetInfoController = GetComponentInChildren<BattleWidgetInfoController>();
    }

    /*public virtual void Init(BattleSceneEditorTest battleSceneEditorTest)
    {
        m_Ctrl = battleSceneEditorTest;
    }*/
    


    public virtual void TestShowResult(BattleResult battleResult)
    { 
        m_CanClick = false;
        Invoke("ActiveCanClick",1);
    }

    private bool m_CanClick;

    void ActiveCanClick()
    {
        m_CanClick = true;
    }

    #region IBattleControllerView
    public virtual NumInfoUi AddNumInfo(int showNum, Transform refer, Vector3 offset, bool moveUp, Vector3 moveUpTargetUVPos, bool follow)
    {
        return null;
    }
    public virtual void OnBattleStart()
    {

    }

    public virtual void OnBattleEnd(BattleResult battleResult)
    {

    }
    #endregion

    /*
    /// <summary>
    /// �������굽UI�����ת��
    /// </summary>
    /// <param name="worldPos"></param>
    /// <param name="offset"></param>
    /// <returns></returns>
    public Vector3 WorldPosToUICameraPos(Vector3 worldPos, Vector3 offset)
    {
        var camera = m_Ctrl.battle3DScene.Camera ;
        if (camera == null)
            return Vector3.zero;

        var viewportPos = camera.WorldToViewportPoint(worldPos);//WorldToScreenPoint(worldPos);

        var uiPos = uiCamera.ViewportToWorldPoint(viewportPos) + offset;//.ScreenToWorldPoint(viewportPos)+offset;//

        return uiPos;
    }
    */

  
}